#pragma once
#include "stdafx.h"
#include "SocketServerMgr.h"
#include "..\ShowLog\LogUtil.h"

class MainFrame : public WindowImplBase, public SocketServerMgr::Listener
{
public:
    virtual void SSM_OnStartCreateServerBegin();
    virtual void SSM_OnStartCreateServerEnd(const bool is_succ, const std::string& msg, const int type);

    virtual void SSM_OnDisconncet(){};

    virtual void SSM_OnGetMssage(const char* msg);
    virtual void SSM_OnAcceptClient(bool is_link);

    virtual void SSM_OnSendMssageBegin(){ log_->SendLog("SSM_OnSendMssageBegin"); };
    virtual void SSM_OnSendMssageEnd(const bool is_succ, const int type);

    virtual void SSM_OnStatuChange(const int statu);

    MainFrame();
    ~MainFrame();
    void InitWindow();
    virtual CDuiString GetSkinFile() override { return _T("server.xml"); };
    virtual CDuiString GetSkinFolder() override { return L""; };
    virtual LPCTSTR GetWindowClassName() const { return _T("MainFrame"); }
    void    Notify(TNotifyUI& msg);
private:
    void OnStartServer();
    void OnDisConnect();
    void OnCloseServer();
    void OnSendMsg();
    void OnStartGet();
    void SetMsg(const std::wstring msg);
private:
    LogUtil* log_;
    SocketServerMgr* mgr_ = nullptr;
    CRichEditUI* get_str;
    std::wstring client_msg_;
};

